private Map<String, Object> beanToMap throws Exception {
//使用Introspector将实体对象转换成map
if (item == null)
return null;
GzWhiteListInfoItem gzWhiteListInfoItem = item.getLineObject();
Map<String, Object> map = new HashMap<String, Object>();
BeanInfo beanInfo = Introspector.getBeanInfo(gzWhiteListInfoItem.getClass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor property : propertyDescriptors) {
String key = property.getName();
//过滤class属性
if (key.compareToIgnoreCase("class") == 0) {
continue;
}
Method getter = property.getReadMethod();
Object value = getter != null ? getter.invoke(gzWhiteListInfoItem) : null;
map.put(key, value);
//取注解(CChar自己定义的注解@CChar(value=3))
CChar annoChar